package com.apes.scm.masterdata.party.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @Title: GatheringInfo
 * @Description: 收款信息
 * @author: ZhengZeXian
 * @create: 2021/8/2 14:51
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = GatheringInfo.CONST_TABLE_NAME)
public class GatheringInfo extends BaseModel {

    public static final String CONST_TABLE_NAME = "mas_gathering_info";

    @Id
    @Column(name = "ID")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "当事人收款信息")
    private long id;

    @Column(name = "account_bank" , length = 32)
    @Comment("收款账户")
    private String accountBank;

    @Column(name = "bank", length = 32)
    @Comment("开户行")
    private String bank;

    @Column(name = "bank_account", length = 32)
    @Comment("开户行帐号")
    private String bankAccount;

    @Comment("支行")
    @Column(name = "subbranch", length = 200)
    private String subbranch;

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 1")
    @Comment("有效")
    private boolean valid = true;

    @ManyToOne(optional = false)
    @JoinColumn(name="PARTY_ID", referencedColumnName="ID", nullable = false)
    private Party party;
}
